package cn.thoughtworks.school.programCenter.services;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Service
public class SimpleCodingQuizService {
    @Autowired
    private AmazonClientService amazonClientService;
    @Value("${amazonProperties.bucketName}")
    private String bucketName;
    @Value("${amazonProperties.rootPath}")
    private String rootPath;

    public String uploadFile(MultipartFile studentAnswer) {
        String fileName = amazonClientService.uploadFile(studentAnswer, "user-answer", bucketName);

        return rootPath + "/" + bucketName + "/user-answer/" + fileName;
    }
}
